/**
 * java.nio的Files和Paths的用法
 */
package edu.gzz;

import java.io.IOException;
import java.nio.file.*;

/**
 * @author gzz
 *
 */
public class NioTest {

	/**
	 * @param args
	 * @throws IOException
	 */
	public static void main(String[] args) throws IOException {
		// 
		var fname = "hehe2.txt";
		Path paths = Paths.get(fname);
		
		//如果文件已存在，则打印，否则创建
		if (Files.exists(paths)) {
			System.out.println("File "+fname+" exists!!");
		} else {
			Files.createFile(paths);
			System.out.println("create file.");
		}

		System.out.println("File name:" + paths.getFileName());
	}
}
